<form action="" method="post">
    日期一：<input type="text" name="date1">
    <br>
    日期二：<input type="text" name="date2">
    <input type="submit" name="sub" value="日期比较">
</form>
<?php
/**
 * User: lie
 * Date: 2020/12/11 11:44
 * Title: 比较时间大小
 * Description:
 * Error:
 */
if ($_POST['sub'] && !empty($_POST['date1']) && !empty($_POST['date2'])) {
    $date1 = strtotime($_POST['date1']);
    $date2 = strtotime($_POST['date2']);
    if ($date1 < $date2) {
        echo $_POST['date1']."比".$_POST['date2']."小";
    } elseif ($date1 == $date2) {
        echo $_POST['date1']."与".$_POST['date2']."日期相等";
    } else {
        echo $_POST['date1']."比".$_POST['date2']."大";
    }
}